package com.stylefeng.guns.rest.modular.banner.service;

import com.stylefeng.guns.rest.common.persistence.dao.BannerMapper;
import com.stylefeng.guns.rest.common.persistence.model.Banner;
import com.stylefeng.guns.rest.modular.banner.controller.dto.BannerRequest;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class BannerService {

    @Autowired
    private BannerMapper bannerMapper;

    //获取轮播图列表
    public List<Banner> getBannerList(BannerRequest request){
        Map<String ,Object> data = new HashedMap();
        data.put("pageIndex",(request.getPage()-1)*request.getSize());
        data.put("pageSize",request.getSize());
        return bannerMapper.getBannerList(data);
    }
}
